package com.windhc.controller;

import com.windhc.model.Cron;
import com.windhc.service.CronService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author windhc
 */
@RestController
public class CronController {

    @Autowired
    private CronService cronService;

    @PostMapping("/cron/add")
    public String add(@RequestBody Cron cron) {
        cronService.add(cron);
        return "success";
    }

    @PostMapping("/cron/delete")
    public String delete(@RequestParam String schedulerId) {
        cronService.delete(schedulerId);
        return "success";
    }
}
